package com.android.tnovoselec.schedule.dto;

import com.j256.ormlite.field.DataType;
import com.j256.ormlite.field.DatabaseField;
import com.j256.ormlite.table.DatabaseTable;
import com.tnovoselec.android.favorites.entity.FavoritesDto;

@DatabaseTable(tableName = "items")
public class ItemDto extends FavoritesDto implements Comparable<ItemDto>{

	@DatabaseField(id = true, canBeNull = false, dataType = DataType.INTEGER)
	private Integer itemId;

	@DatabaseField(canBeNull = false, dataType = DataType.INTEGER)
	private int day;

	@DatabaseField(canBeNull = false, dataType = DataType.INTEGER)
	private int order;

	@DatabaseField(canBeNull = false, dataType = DataType.STRING)
	private String hoursFrom;

	@DatabaseField(canBeNull = false, dataType = DataType.STRING)
	private String hoursTo;

	@DatabaseField(canBeNull = false, dataType = DataType.STRING)
	private String title;

	@DatabaseField(canBeNull = false, dataType = DataType.STRING)
	private String notes;
	
	

	public Integer getItemId() {
		return itemId;
	}

	public void setItemId(Integer itemId) {
		this.itemId = itemId;
	}

	public int getDay() {
		return day;
	}

	public void setDay(int day) {
		this.day = day;
	}

	public int getOrder() {
		return order;
	}

	public void setOrder(int order) {
		this.order = order;
	}

	public String getHoursFrom() {
		return hoursFrom;
	}

	public void setHoursFrom(String hoursFrom) {
		this.hoursFrom = hoursFrom;
	}

	public String getHoursTo() {
		return hoursTo;
	}

	public void setHoursTo(String hoursTo) {
		this.hoursTo = hoursTo;
	}

	public String getTitle() {
		return title;
	}

	public void setTitle(String title) {
		this.title = title;
	}

	public String getNotes() {
		return notes;
	}

	public void setNotes(String notes) {
		this.notes = notes;
	}

	@Override
	public boolean isValid() {
		return true;
	}

	public static String getCreateQuery() {
		return "CREATE TABLE IF NOT EXISTS `items` (" +
					"`itemId` INTEGER NOT NULL  PRIMARY KEY AUTOINCREMENT," + 
					"`day` INTEGER NOT NULL,"+ 
					"`order` INTEGER NOT NULL,"+
					"`hoursFrom` TEXT NOT NULL," +
					"`hoursTo` TEXT NOT NULL," +
					"`title` text NOT NULL,"+
					"`notes` text ) ;";
	}

	@Override
	public int compareTo(ItemDto another) {
		
		return this.order - another.getOrder();
	}

}
